<div>
	<table class="layui-hide" id="tblserve" lay-filter="tblserve"></table>
</div>

<script type="text/html" id="barserve">
	<form class="layui-form" id="formserve" lay-filter="formserve">
	<div class="layui-form-item" pane="" style="margin-left: -20px; margin-bottom: -20px;margin-top: -10px;">
		<label class="layui-form-label" style="width: 100px;">服务类型</label>
		<div class="layui-input-block">
			<input type="checkbox" name="serve_type"  value="0" lay-skin="primary" title="咨询" checked="">
			<input type="checkbox" name="serve_type"  value="1" lay-skin="primary" title="投诉">
			<input type="checkbox" name="serve_type"   value="2"  lay-skin="primary" title="建议">
		</div>
	</div>
	<div class="layui-form-item" pane="" style="margin-left: -20px; margin-bottom: -20px;margin-top: -10px;">
		<label class="layui-form-label" style="width: 100px;">客户满意度</label>
		<div class="layui-input-block">
			<input type="checkbox" name="cus_sat" lay-skin="primary" value="3" title="三星" checked="">
			<input type="checkbox" name="cus_sat" lay-skin="primary" value="4" title="四星">
			<input type="checkbox" name="cus_sat" lay-skin="primary" value="5" title="五星">
		</div>
	</div>
	<div class="layui-form-item" pane="" style="margin-left: -20px; margin-bottom: 6px;margin-top: -10px;">
		<label class="layui-form-label" style="width: 100px;">创建人</label>
		<div class="layui-input-block">
			<input type="checkbox" name="serve_creator" lay-skin="primary" value="1" title="客户经理" checked="">
			<input type="checkbox" name="serve_creator"   lay-skin="primary" value="2" title="总监">
		</div>
	</div>
	<div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo"  style="width: 74px; height: 30px;margin-left: -100px; text-align: center; "  >查询</button>
        </div>
    </div>
    </form>

</script>
<script>
	var row = null
	var table
	var form

	layui.use(['table', 'jquery', 'form', ], function() {
		table = layui.table;
		var $ = layui.jquery;
		form = layui.form;

		table.render({
			elem: '#tblserve' //指定渲染的table标签
				,
			url: 'http://localhost:8080/serve/getServeList1' //获取数据的URL地址
				,
			cols: [
				[{
					checkbox: true
				}, {
					field: 'seNo',
					title: '服务编号',
					width: 90
				}, {
					field: 'seType',
					title: '服务类型',
					width: 90,
					templet:function (row) {
						switch (row.seType) {
							case 0:
								return '咨询'
								break;
							case 1:
								return '投诉'
								break;
							case 2:
								return '建议'
								break;
						}
					}
				}, {
					field: 'seDetail',
					title: '服务详细内容',
					width: 115
				}, {
					field: 'seState',
					width: 90,
					title: '服务状态',
					templet:function (row) {
						switch (row.seState) {
							case 3:
								return '已归档'
								break;
							case 2:
								return '已处理'
								break;
							case 1:
								return '已分配'
								break;
							case 0:
								return '已创建'
								break;
						}
					}
					
				}, {
					field: 'seCreator',
					width: 90,
					title: '创建人'
				}, {
					field: 'seCreatdate',
					width: 150,
					title: '创建时间'
				}, {
					field: 'seAssigindate',
					width: 150,
					title: '分配时间'
				}, {
					field: 'seMethod',
					width: 90,
					title: '处理方法'
				}, {
					field: 'seProcessdate',
					width: 150,
					title: '处理时间'
				}, {
					field: 'seProcessor',
					width: 90,
					title: '处理人'
				}, {
					field: 'seResult',
					width: 90,
					title: '处理结果'
				}, {
					field: 'seStatisficing',
					width: 90,
					title: '满意度',
					templet:function (row) {
						switch (row.seStatisficing) {
							case 3:
								return '三星'
								break;
							case 4:
								return '四星'
								break;
							case 5:
								return '五星'
								break;
						}
					}
				}]
			],
			page: true //允许显示分页工具栏
				,
			height: 'full-160' //设置表格的高度
				,
			limit: 5,
			limits: [5, 10, 15, 20, 25, 30],
			toolbar: '#barserve' //设置整个表格的工具栏
				,
			defaultToolbar: [],
			 where:{seState:3}//设置默认工具栏不显示
		});

		//监听事件
		
			form.on('submit(formDemo)', function(data){
				var arrCreator = []
				var creatorList = $("[name='serve_creator']:checked")
				for(var i=0;i<creatorList.length;i++){
					arrCreator.push(creatorList[i].value)
				}
				
				var arrType = []
				var typeList = $("[name='serve_type']:checked")
				for(var i=0;i<typeList.length;i++){
					arrType.push(typeList[i].value)
				}
				
				var arrSat = []
				var satList = $("[name='cus_sat']:checked")
				for(var i=0;i<satList.length;i++){
					arrSat.push(satList[i].value)
				}
				 table.reload('tblserve',{
				  where:{
					  serveCreator:arrCreator.join(","),
					  serveType:arrType.join(","),
					   serveSas:arrSat.join(",")
				  },
				  page:{
					  curr:1//删除信息后跳转到第一页显示,避免最后一页全部删除后出现空白
				  }
				 })
			    return false;
			  }); 

	});
</script>
